package com.tuozixuan;

import java.util.List;

import com.tuozixuan.config.Config;
import com.tuozixuan.handler.Handler;

import cn.hutool.core.util.ServiceLoaderUtil;
import cn.hutool.setting.yaml.YamlUtil;

public class App 
{
    public static void main( String[] args ) throws Exception 
    {
        Config config = YamlUtil.loadByPath("config.yml", Config.class);
        
        List<Handler> handlerList = ServiceLoaderUtil.loadList(Handler.class);
        handlerList.stream().filter(handler -> config.getOperate() == handler.getOperate())
        	.findAny().orElseThrow().execute(config);
    }
}
